package com.spzx.channel.service.imp;

import com.spzx.channel.service.IBrandService;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.domain.R;
import com.spzx.common.core.exception.ServiceException;
import com.spzx.product.api.RemoteBrandService;
import com.spzx.product.api.domain.vo.Brand;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BrandServiceImpl implements IBrandService {
    @Resource
    RemoteBrandService remoteBrandService;
    @Override
    public List<Brand> getBrandAll() {
        R<List<Brand>> brandAllList = remoteBrandService.getBrandAllList(SecurityConstants.INNER);
        if (R.FAIL == brandAllList.getCode()){
            throw new ServiceException(brandAllList.getMsg());
        }
        return brandAllList.getData();
    }
}
